﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Caifu.Clients;

namespace Caifu.WebSite
{
	public partial class NetDaily : System.Web.UI.Page
	{
		protected int m_i;

		protected void Page_Load(object sender, EventArgs e)
		{
			//var allNetValueDailys = NetValueDailyClient.GetAllNetValueDailys();
			//var dataSource = allNetValueDailys;
			//this.Repeater1.DataSource = dataSource;
			//this.DataBind();
		}

		protected string GetDataSource()
		{
			var all = NetValueDailyClient.GetAllNetValueDailys();
			string result = "[";
			string header = "['FundCode','FundName','ReportDate','UnitNetValue','PreviousUnitNetValue','GrowthValue','GrowthRate']";
			result += header;
			foreach (var item in all)
			{
				string temp = ",['{0}','{1}','{2}','{3}','{4}','{5}','{6}']";
				temp = String.Format(temp,
										item.FundCode,
										item.FundName,
										item.ReportDate.ToString("yyyy-MM-dd"),
										item.UnitNetValue,
										item.PreviousUnitNetValue,
										item.GrowthValue,
										item.GrowthRate);

				result += temp;
			}
			result += "]";

			return result;
		}
	}
}